package com.geeker.module.sys.log.controller;

import com.geeker.common.api.CommonResult;
import com.geeker.common.util.PageUtil;
import com.geeker.module.sys.log.domain.SysLogOperate;
import com.geeker.module.sys.log.dto.SysLogOperateDto;
import com.geeker.module.sys.log.service.SysLogOperateService;
import com.mybatisflex.core.paginate.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Tag(name  = "操作日志")
@RequestMapping("/sys/log/operate")
public class SysLogOperateController {

    @Autowired
    private SysLogOperateService sysLogOperateService;

    @Operation(summary = "分页")
    @PostMapping("/page")
    public CommonResult<Page<SysLogOperate>> page(@RequestBody SysLogOperateDto dto) {
        Page<SysLogOperate> page = PageUtil.getPage(dto);
        Page<SysLogOperate> iPage = sysLogOperateService.page(page);
        return CommonResult.success(iPage);
    }

    @Operation(summary = "详情")
    @PostMapping(value = "detail/{operId}")
    public CommonResult<SysLogOperate> detail(@PathVariable Long operId) {
        return CommonResult.success(sysLogOperateService.getById(operId));
    }
}
